<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/axios-0.18.0.js"></script>
    <script src="js/vuejs-2.5.16.js"></script>
</head>
<body>
    <div id="app">
        <form onsubmit="return false">
            账户:<input type="text" value="name" v-model="account.name">
            金额:<input type="text" value="money" v-model="account.money">
            <input type="submit" value="添加" @click="addAccount()"/><br/>
        </form>
    </div>
    <script type="text/javascript">
        new Vue({
           el:"#app",
           data:{
            account:{}
           },
           methods:{
            addAccount(){
                let param=this.account;
                axios.post("/account/addAccount",param).then(response=>{
                    if (response.data.flag){
                        location.href="/accountList.html"
                    }
                }).catch(error=>{
                    console.log(error)
                });
            }
           }
        });
    </script>
</body>
</html>